<template>
  <div class="check-subject-container common-check-container">
    <div class="common-list-bread">
      <el-button class="common-btn-solid" size="small" @click="onClickCancel"
        >返回</el-button
      >
      <span class="title"
        >查看试验科目</span
      >
    </div>
    <div class="subject-add-container  container">
      <div class="common-detail-box">
        <!--  -->
        <el-form
          :model="detailInfo"
          ref="detailInfo"
          :rules="rules"
          label-width="150px"
          
        >
          <div class="common-two-box">
            <el-form-item label="所属任务：" class="width-160">
              <span>所属任务</span>
            </el-form-item>
            <el-form-item label="科目代号：">
               <span>科目代号</span>
            </el-form-item>
          </div>
          <div class="common-two-box">
            <el-form-item label="科目名称：" class="width-160">
                <span>科目名称</span>
            </el-form-item>
            <el-form-item label="科目责任人："  class="width-160">
                 <span>科目责任人</span>
            </el-form-item>
          </div>
          <div class="common-two-box">
            <el-form-item  label="科目时间：" class="width-160">
              2020-10-10
              至
              2020-10-11
            </el-form-item>
            <el-form-item label="被测装备：" class="width-160">
               <span>科目，责任人</span>
            </el-form-item>
          </div>
          <div class="common-two-box">
            <el-form-item label="优先级：" class="width-160">
               <span>高</span>
            </el-form-item>
          </div>
          <el-form-item label="所需试验人员：" class="resident-unit">
            3人 射击、试验、人员
          </el-form-item>
          <el-form-item label="所需试验场地：" class="resident-unit">
             3人 射击、试验、人员
          </el-form-item>
          <el-form-item label="所需试验装备：" class="resident-unit">
            3人 射击、试验、人员
          </el-form-item>
          <el-form-item label="科目描述：" class="subject-desc">
             <span>科目描述科目描述科目描述科目描述科目描述</span>
          </el-form-item>
          <el-form-item label=" " class="upload-content">
             <div class="file"><i class="el-icon-document i"></i>  文件   <i class="el-icon-download i"></i><span class="download" @click="onClickDownLoadBtn">下载</span></div>
                  <div class="file"><i class="el-icon-document i"></i>文件   <i class="el-icon-download i"></i><span class="download" @click="onClickDownLoadBtn">下载</span></div>
            
          </el-form-item>
          <el-form-item label="验收标准：" class="subject-desc">
             <span>验收标准验收标准验收标准验收标准验收标准</span>
          </el-form-item>
          <el-form-item label=" " class="upload-content">
             <div class="file"><i class="el-icon-document i"></i>  文件   <i class="el-icon-download i"></i><span class="download" @click="onClickDownLoadBtn">下载</span></div>
                  <div class="file"><i class="el-icon-document i"></i> 文件   <i class="el-icon-download i"></i><span class="download" @click="onClickDownLoadBtn">下载</span></div>
            
          </el-form-item>
        </el-form>
      </div>
      <div class="common-list-bread">
        <span class="title">资源配置方案</span>
      </div>
      <div class="two-content">
       <!--  <el-button
          class="common-btn-primary config-btn"
          size="small"
          @click=" onClickGeneratePlan"
          >生成资源配置方案</el-button
        >
        <span class="text-desc"
          >以上基本信息修改后，需手动再次生成资源配置方案</span
        >
      </div> -->
      <div class="two-wrapper">
          <div>
            <div class="wrapper-item" v-for="(item,index) in equipmentUnderTestList" :key="index">
              <div class="wrapper-title">
                <span class="title-desc">被测装备{{index+1}}</span>
               <!--  <span class="title-del"
                  ><i class="el-icon-delete"></i> <span class="del"  @click="onClickDelInfo(4,index)"> 删除</span></span
                > -->
              </div>
              <el-form
                label-width="150px"
                :inline="true"
                
              >
                <!-- <div class="common-two-box"> -->
                <el-form-item label="被测装备："  class="width-160">
                  <span>装备</span>
                </el-form-item>
                <el-form-item label="就位时间：" class="width-208">
                   <span>就位时间</span>
                </el-form-item>
                <el-form-item label="撤离时间：" class="width-208">
                   <span>撤离时间</span>
                </el-form-item>
                <el-form-item label="静态位置：" class="width-160">
                   <span>静态位置</span>
                </el-form-item>
                <el-form-item label="经纬度：">
                   <span>经纬度</span>
                </el-form-item>
                <span v-for="(info,idx) in item.attributeRoList" :key="idx">
                  <template v-if="idx==0||idx==2||idx==4||idx==6||idx==7||idx==9">
                      <el-form-item :label="info.name+'：'" class="width-530">
                         <span>方法</span>
                    </el-form-item>
                  </template>
                  <template v-else>
                    <el-form-item :label="info.name+'：'" class="width-208 active">
                      <span>方法</span>
                    </el-form-item>
                  </template> 
                 </span>
                 <!--
                   <el-form-item label="启动方法：" class="width-530">
                  <el-input
                    v-model.trim="detailInfo.alias"
                    placeholder="请输入"
                    :maxlength="50"
                    clearable
                  ></el-input>
                </el-form-item>
                <el-form-item label="启动时间：" class="width-208 active">
                  <el-date-picker
                    value-format="yyyy-MM-dd"
                    v-model="detailInfo.sDate"
                    type="date"
                    :clearable="false"
                    :editable="false"
                    placeholder="请选择"
                  >
                  </el-date-picker>
                </el-form-item>
                   <el-form-item label="停止方法：" class="width-530">
                  <el-input
                    v-model.trim="detailInfo.alias"
                    placeholder="请输入"
                    :maxlength="50"
                    clearable
                  ></el-input>
                </el-form-item>
                <el-form-item label="停止时间：" class="width-208 active">
                  <el-date-picker
                    value-format="yyyy-MM-dd"
                    v-model="detailInfo.sDate"
                    type="date"
                    :clearable="false"
                    :editable="false"
                    placeholder="请选择"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="固定方法：" class="width-530">
                  <el-input
                    v-model.trim="detailInfo.alias"
                    placeholder="请输入"
                    :maxlength="50"
                    clearable
                  ></el-input>
                </el-form-item>
                <el-form-item label="固定时间：" class="width-208 active">
                  <el-date-picker
                    value-format="yyyy-MM-dd"
                    v-model="detailInfo.sDate"
                    type="date"
                    :clearable="false"
                    :editable="false"
                    placeholder="请选择"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="撤离方法：" class="width-530">
                  <el-input
                    v-model.trim="detailInfo.alias"
                    placeholder="请输入"
                    :maxlength="50"
                    clearable
                  ></el-input>
                </el-form-item>

                <el-form-item label="移动方法：" class="width-530">
                  <el-input
                    v-model.trim="detailInfo.alias"
                    placeholder="请输入"
                    :maxlength="50"
                    clearable
                  ></el-input>
                </el-form-item>
                <el-form-item label="移动时间：" class="width-208 active">
                  <el-date-picker
                    value-format="yyyy-MM-dd"
                    v-model="detailInfo.sDate"
                    type="date"
                    :clearable="false"
                    :editable="false"
                    placeholder="请选择"
                  >
                  </el-date-picker>
                </el-form-item>
                <el-form-item label="移动范围：" class="width-530">
                  <el-input
                    v-model.trim="detailInfo.alias"
                    placeholder="请输入"
                    :maxlength="50"
                    clearable
                  ></el-input>
                </el-form-item> -->
              </el-form>
            </div>
          </div>
          <!-- <el-button class="common-btn-solid blue add" size="small" @click="onClickAddInfo(4)">继续添加被测装备</el-button> -->
           <div>
             <div class="wrapper-item"  v-for="(item,index) in testEquipmentList" :key="index">
            <div class="wrapper-title">
              <span class="title-desc">试验装备{{index+1}}</span>
             <!--  <span class="title-del" 
                ><i class="el-icon-delete"></i> <span class="del"  @click="onClickDelInfo(2,index)"> 删除</span></span
              > -->
            </div>
            <el-form
              label-width="150px"
              :inline="true"
            >
              <el-form-item label="试验装备：" class="width-160">
                  <span>试验装备</span>
              </el-form-item>
              <el-form-item label="就位时间：" class="width-208">
                  <span>就位时间</span>
              </el-form-item>
              <el-form-item label="撤离时间：" class="width-208">
                <span>撤离时间</span>
              </el-form-item>
              <el-form-item label="静态位置：" class="width-160">
                 <span>静态位置</span>
              </el-form-item>
              <el-form-item label="经纬度：">
                <span>经纬度</span>
              </el-form-item>
              <span v-for="(info,idx) in item.attributeRoList" :key="idx">
                  <template v-if="idx==0||idx==2||idx==4||idx==6||idx==7||idx==9">
                      <el-form-item :label="info.name+'：'" class="width-530">
                          <span>方法</span>
                    </el-form-item>
                  </template>
                  <template v-else>
                    <el-form-item :label="info.name+'：'" class="width-208 active">
                         <span>方法</span>
                     </el-form-item>
                  </template> 
              </span>
              <!-- <el-form-item label="启动方法：" class="width-530">
                <el-input
                  v-model.trim="detailInfo.alias"
                  placeholder="请输入"
                  :maxlength="50"
                  clearable
                ></el-input>
              </el-form-item>
              <el-form-item label="启动时间：" class="width-208 active">
                <el-date-picker
                  value-format="yyyy-MM-dd"
                  v-model="detailInfo.sDate"
                  type="date"
                  :clearable="false"
                  :editable="false"
                  placeholder="请选择"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item label="停止方法：" class="width-530">
                <el-input
                  v-model.trim="detailInfo.alias"
                  placeholder="请输入"
                  :maxlength="50"
                  clearable
                ></el-input>
              </el-form-item>
              <el-form-item label="停止时间：" class="width-208 active">
                <el-date-picker
                  value-format="yyyy-MM-dd"
                  v-model="detailInfo.sDate"
                  type="date"
                  :clearable="false"
                  :editable="false"
                  placeholder="请选择"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item label="固定方法：" class="width-530">
                <el-input
                  v-model.trim="detailInfo.alias"
                  placeholder="请输入"
                  :maxlength="50"
                  clearable
                ></el-input>
              </el-form-item>
              <el-form-item label="固定时间：" class="width-208 active">
                <el-date-picker
                  value-format="yyyy-MM-dd"
                  v-model="detailInfo.sDate"
                  type="date"
                  :clearable="false"
                  :editable="false"
                  placeholder="请选择"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item label="撤离方法：" class="width-530">
                <el-input
                  v-model.trim="detailInfo.alias"
                  placeholder="请输入"
                  :maxlength="50"
                  clearable
                ></el-input>
              </el-form-item>

              <el-form-item label="移动方法：" class="width-530">
                <el-input
                  v-model.trim="detailInfo.alias"
                  placeholder="请输入"
                  :maxlength="50"
                  clearable
                ></el-input>
              </el-form-item>
              <el-form-item label="移动时间：" class="width-208 active">
                <el-date-picker
                  value-format="yyyy-MM-dd"
                  v-model="detailInfo.sDate"
                  type="date"
                  :clearable="false"
                  :editable="false"
                  placeholder="请选择"
                >
                </el-date-picker>
              </el-form-item>
              <el-form-item label="移动范围：" class="width-530">
                <el-input
                  v-model.trim="detailInfo.alias"
                  placeholder="请输入"
                  :maxlength="50"
                  clearable
                ></el-input>
              </el-form-item> -->
            </el-form>
          </div>     
          </div>     
           <div>
          <div class="wrapper-item"   v-for="(item,index) in testPeopleList" :key="index">
            <div class="wrapper-title">
              <span class="title-desc">试验人员{{index+1}}</span>
            </div>
            <el-form
              label-width="150px"
              :inline="true"
              
            >
              <el-form-item label="试验人员：" class="width-160">
                <span>试验人员</span>
              </el-form-item>

              <el-form-item label="就位时间：" class="width-208">
                 <span>就位时间</span>
              </el-form-item>
              <el-form-item label="撤离时间：" class="width-208">
                 <span>撤离时间</span>
              </el-form-item>
              <el-form-item label="静态位置：" class="width-160">
                 <span>静态位置</span>
              </el-form-item>
              <el-form-item label="经纬度：">
                 <span>经纬度</span>
              </el-form-item>
            </el-form>
          </div>     
          </div>     
           <div>
          <div class="wrapper-item"    v-for="(item,index) in testPlaceList" :key="index">
            <div class="wrapper-title">
              <span class="title-desc">试验场地{{index+1}}</span>
            </div>
            <el-form
              label-width="150px"
              :inline="true"
              
            >
              <el-form-item label="试验场地："  class="width-160">
                <span>试验场地</span>
              </el-form-item>

              <el-form-item label="启动时间：" class="width-208">
                 <span>启动时间</span>
              </el-form-item>
              <el-form-item label="关闭时间：" class="width-208">
                 <span>关闭时间</span>
              </el-form-item>
            </el-form>
          </div>     
          </div>     
      </div>
    </div>
    <div class="common-footer">
      <el-button class="common-btn-primary" @click="onClickCancel"
        >返回</el-button
      >
    </div>
    <form action="/api/template/downloadFile" method="get" ref="downLoadForm" hidden>
        <input type="hidden" name="templateId" v-model="curId">
    </form>
  </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      detailInfo: {
        startTime: "", //科目开始时间
        endTime: "", //科目结束时间
        acceptanceCriteriaAccessoryList: [],//上传1
        resourceAllocationDoList: [],//上传2
        taskId:'',//所属任务   
        name:'',//科目名称 
        code:'',//科目代号 
        chargePersonId:'',//试验负责人  
        priorityLevel:'',//优先级  
        useEquipmentId:[],//被测装备
        personCount:'',//所需试验人员数量 
        fieldCount:'',//所需试验场地数量 
        experimentQuipmentCount:'',//所需试验装备 
        describe:'',//科目描述 
        acceptanceCriteria:'',//验收标准




      },
      airportTypeList: [{
        airportTypeId :1,
        airportType :'test1',
      },
      {
        airportTypeId :2,
        airportType :'test2',
      },
      {
        airportTypeId :3,
        airportType :'test3',
      }], //机场属性集合
      modelTypeList: [], //所驻机型集合
      // pointError: false, //机场坐标填写是否有错

      /* 校验必填规则 */
      rules: {
        taskId: [
          {
            required: true,
            message: "请选择所属任务",
            trigger: ["blur", "change"],
          },
        ],
        name: [
          {
            required: true,
            message: "请输入科目名称",
            trigger: ["blur", "change"],
          },
        ],
        code: [
          {
            required: true,
            message: "请输入科目代号",
            trigger: ["blur", "change"],
          },
        ],
        chargePersonId: [
          {
            required: true,
            message: "请输入试验负责人",
            trigger: ["blur", "change"],
          },
        ],
       },



      enterType: "", //1->添加 2->编辑
    





      curFlag:'',//点击上传按钮下标 
      isUploading:false,//是否正在上传
      checkPeopleList:[],//选中所需试验人员 
      checkEquipmentList:[],//选中所需试验装备 
      checkPlaceList:[],//选中所需试验场地  
      checkboxPeopleList:[{'name':'人员',id:1}],//试验人员List  
      checkboxEquipmentList:[{'name':'装备',id:1}],//试验装备List 
      checkboxPlaceList:[{'name':'场地',id:1}],//试验场地List 
      priorityLevelList:[{'name':'高',id:1},{'name':'中',id:2},{'name':'低',id:3}],//试验场地List 

      /* 资源配置 被测装备*/
      equipmentUnderTestList:[ 
        {
          baseResourceId:'',//装备id
          resourceType:4,//资源类型
          inplaceTime:'',//就位时间
          evacuationTime:'',//撤离时间
          staticPosition:'',//静态位置
          pointError: false,//坐标校验
          coordinate:{//经纬度
              lng: {
                deg: '',
                min: '',
                sec: ''
            },
            lat: {
              deg: '',
              min: '',
              sec: ''
            }
          },
          attributeRoList:[]
        }
      ],
      /* 资源配置 试验装备*/
      testEquipmentList:[  
        {
          baseResourceId:'',//装备id
          resourceType:2,//资源类型
          inplaceTime:'',//就位时间
          evacuationTime:'',//撤离时间
          staticPosition:'',//静态位置
          pointError: false,//坐标校验

          coordinate:{//经纬度
              lng: {
              deg: '',
              min: '',
              sec: ''
            },
            lat: {
              deg: '',
              min: '',
              sec: ''
            }
          },
        }
      ],
      /* 资源配置 试验人员*/
      testPeopleList:[  
        {
          baseResourceId:'',//装备id
          resourceType:1,//资源类型
          inplaceTime:'',//就位时间
          evacuationTime:'',//撤离时间
          staticPosition:'',//静态位置
          pointError: false,//坐标校验

          coordinate:{//经纬度
              lng: {
              deg: '',
              min: '',
              sec: ''
            },
            lat: {
              deg: '',
              min: '',
              sec: ''
            }
          },
        }
      ],
      /* 资源配置 试验场地*/
      testPlaceList:[
        {
          baseResourceId:'',//场地id
          resourceType:3,//资源类型
          inplaceTime:'',//就位时间
          evacuationTime:'',//撤离时间
        }
      ],
      bakObj:{ //备份添加数据
          baseResourceId:'',//场地id
          resourceType:'',//资源类型
          inplaceTime:'',//就位时间
          evacuationTime:'',//撤离时间
          pointError: false,//坐标校验
      },
      bakCoordinate:{//备份经纬度
          lng: {
              deg: '',
              min: '',
              sec: ''
            },
          lat: {
            deg: '',
            min: '',
            sec: ''
          }
      },
      equipmentUnderTestListData:[
        {
          name:'哈哈',
          id:1
        },
        {
          name:'呵呵',
          id:2
        },
        {
          name:'嘿嘿',
          id:3
        },
        {
          name:'真帅',
          id:4
        }
      ],//被测装备集合
      testEquipmentListData:[],//试验装备集合
      testPeopleListData:[],//人员集合
      testPlaceListData:[],//地方集合

      actionType: 1,



      curId: '',//下载对应的文件id
    };
  },
  created() {
    // this.initData();
  },
  mounted() {
    // watchOverflow();
    /* this.asyncListData(1);
    this.asyncListData(2);
    this.asyncListData(3);
    this.asyncListData(4); */
    

  },
  methods: {

      //点击--下载
      onClickDownLoadBtn(id) {
        this.curId = id;
        this.$nextTick(()=> {
          this.$refs.downLoadForm.submit()
        })
      },

    
    //生成资源配置方案
    onClickGeneratePlan(){
      console.log(this.checkPeopleList)

    /* 相关参数
       this.useEquipmentId.join(',')
        this.personCount
        this.experimentQuipmentCount
        this.fieldCount
 

        checkPeopleList:[],//选中所需试验人员 
        checkEquipmentList:[],//选中所需试验装备 
        checkPlaceList:[],//选中所需试验场地  */


      /* this.$axios.get("/airport/getAirportInfo?id=" + type).then((res) => {
        if (res.data.code === 200) {
          this[obj[type]] = [... res.data.data];
        } else {
          this.$message.error(res.data.msg);
        }
      }); */
    },
    //获取资源配置下拉框数据???
    asyncListData(type) {
      let obj = {'1':'equipmentUnderTestListData','2':'testEquipmentListData','3':'testPeopleListData','4':'testPlaceListData'};
      this[obj[type]] = [type];
     /*  this.$axios.get("/airport/getAirportInfo?id=" + type).then((res) => {
        if (res.data.code === 200) {
          this[obj[type]] = [... res.data.data];
        } else {
          this.$message.error(res.data.msg);
        }
      }); */
    },
    //修改对应的下拉框请求对应的数据
    onChangeResource(val,item){
      /* this.$axios.get("/ccccx/xxxxx?id=" + val).then((res) => {
        if (res.data.code === 200) {
          let data = res.data.data;
          item.inplaceTime = '';
          item.evacuationTime = '';
          item.inplaceTime = '';
          if(item.resourceType!=3) {
            item.pointError = false;
            item.coordinate = this.bakCoordinate;
          } else if(item.resourceType==2 || item.resourceType==4) {
            item.attributeRoList = data.attributeRoList;
          }
        } else {
          this.$message.error(res.data.msg);
        }
      }); */
    },
    //添加对应的资源配置
    onClickAddInfo(type){    
      let obj = {'4':'equipmentUnderTestList','2':'testEquipmentList','1':'testPeopleList','3':'testPlaceList'};
      let text = {'4':'被测装备','2':'试验装备','1':'试验人员','3':'试验场地'};
      let flag = this[obj[type]].findIndex(item=>item.baseResourceId=='');
      if(flag!= -1) {
        this.$message.error(`${text[type]}不能为空`);
        return;
      }
      let _info = Object.assign({},this.bakObj);
      _info.resourceType = type;
      if (type!==3) {
        let  _coordinate = {
              coordinate:this.bakCoordinate
        }
        _info = Object.assign({},_info,_coordinate);
      }
      this[obj[type]].push(_info);
    },
    //删除对应的资源配置
    onClickDelInfo(type,index){
      let obj = {'4':'equipmentUnderTestList','2':'testEquipmentList','1':'testPeopleList','3':'testPlaceList'};
      this.$confirm("确认删除该配置吗？", "删除确认", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        showClose: false,
        type: "warning",
        center: true,
        customClass: "common-confirm-box",
        confirmButtonClass: "common-btn-primary",
        cancelButtonClass: "common-btn-text",
      }).then(() => {
          this[obj[type]].splice(index,1);
      });
    },
    /* 上传相关start */
    //点击--上传按钮下标 
    onClickCurFlag(type) {
      if(this.isUploading) {
        this.$message.error('有文件正在上传，请稍后重试');
        return;
      }
      this.curFlag = type;
      console.log(this.curFlag)
    },
    //上传前校验
    beforeUpload(file) {
      const fileSize = file.size / 1024 / 1024 < 20;
      if (!fileSize) {
        this.$message.warning("上传文件大小不超过20M");
        return false;
      }
    },
    //文件上传时
    handleProgress() {
      this.isUploading = true;
    },
    //文件上传成功时  共用上传 通过点击哪一个做为标识 给那个数组添加 上传结果
    handleSuccess(res, file, fileList) {
      //错误处理
      if (res.code !== 200) {
        this.$message.error(res.msg);
      }
      let completed = false;
      if (fileList && fileList.length > 0) {
        completed = fileList.every((item) => {
          return item.status === "success";
        });
      }
      if (completed) {
        let _fileList = [];
        fileList.forEach((item) => {
          if (!item.response) {
            _fileList.push(item);
          } else if (item.response.code === 200) {
            this.$set(item.response.data, "accessoryFilename", item.response.data.fileName);
            this.$set(item.response.data, "accessoryUrl", item.response.data.fileUrl);
            _fileList.push(item.response.data);
          }
        });
        if(this.curFlag===1) {
          this.detailInfo.acceptanceCriteriaAccessoryList = _fileList;
        }else {
          this.detailInfo.resourceAllocationDoList = _fileList;
        }
        this.isUploading = false;
      }
    },
    //文件上传失败时
    handleError() {
      this.isUploading = false;
    },
    //文件列表移除文件时
    handleRemove(file, fileList) {
      this.commonDelFile(fileList,1);
    },
    //针对第二个上传做删除区分
    handleRemove2(file, fileList) {
      this.commonDelFile(fileList,2);
    },
    /// 上传共用删除
    commonDelFile(fileList,type){
      let _isCompleted = null;
      if (fileList && fileList.length > 0) {
        _isCompleted = fileList.every((item) => {
          return item.status === "success";
        });
        this.isUploading = !_isCompleted;
      } else {
        this.isUploading = false;
        if(type===1) {
           this.detailInfo.acceptanceCriteriaAccessoryList = [];
        } else {
          this.detailInfo.resourceAllocationDoList = [];
        }
      }
       if(type===1) {
           this.detailInfo.acceptanceCriteriaAccessoryList = fileList;
        } else {
          this.detailInfo.resourceAllocationDoList = fileList;
        }
    },
    //文件超出个数限制时
    handleExceed() {
      this.$message.warning("最多可上传5个文件");
    },

    /* 上传相关end */

    initData() {
      /*this.queryParams = this.$route.query;
      this.actionType = this.queryParams.actionType;
      this.airportId = this.queryParams.id || "";
      this.addFlag = this.queryParams.addFlag;
       if (this.actionType === "1") {
        this.isAirportExit = false;
        this.asyncGetDetailData(this.airportId);
      } */


     
    },
    //回显数据
    asyncGetDetailData(id) {
      this.$axios.get("/airport/getAirportInfo?id=" + id).then((res) => {
        if (res.data.code === 200) {
          const data = res.data.data;
          Object.keys(data).forEach((item) => {
            this.detailInfo[item] = data[item];
          });
          this.detailInfo.coordinate = JSON.parse(data.coordinate);
          this.detailInfo.closePeriodType =
            data.closePeriodType === 2 ? true : false;
          this.detailInfo.statisticTomorrowPlanFlag =
            data.statisticTomorrowPlanFlag === 1 ? true : false;
        }
      });
    },
    //监听坐标变化
    onPointChange(val,item,type) {
      item.coordinate = val;
    },
    //监听坐标错误
    onPointError(val,item,type) {
      item.pointError = val ? true : false;
    },
   
    //点击取消
    onClickCancel() {
      this.$router.push({
        path: "/experimentSubject"/* ,
        query: this.queryParams, */
      });
    },
    
  },
 /*  watch: {
    $route(to) {
      if (to.path.includes("/airportManage/edit")) {
        this.initData();
      }
    },
  }, */
};
</script>
<style scoped lang="scss">
.required-flag:before,
.label-required-flag .el-form-item__label::before {
  content: "*";
  color: #f56c6c;
  margin-right: 4px;
}
.subject-add-container .el-date-editor {
  /* margin-right: 12px; */
}
.airport-exit-text {
  display: inline-block;
  margin-left: 20px;
}
.airport-exit-text > span {
  color: rgb(81, 123, 245);
  text-decoration: underline;
  letter-spacing: 2px;
  cursor: pointer;
}

.textarea-info {
  width: 642px;
}
.container {
  background-color: #fff;
}
.title {
  padding-left: 10px;
}
.subject-add-container {
  overflow-y: auto;
  .common-detail-box {
    padding: 30px 0 30px;
  }
  .common-item-label {
    width: 72px;
    flex: 0 0 72px;
    font-weight: 400;
  }
  .common-item-box {
    margin-bottom: 20px;
    align-items: center;
  }
  .width-160 /deep/ .el-input,
  .common-two-box /deep/ .el-input__inner {
    width: 160px;
  }
  /deep/ .el-input-number--mini .el-input-number__decrease,
  /deep/ .el-input-number--mini .el-input-number__increase {
    width: 14px;
  }
  /deep/ .el-input-number.is-controls-right .el-input__inner {
    width: 43px;
    text-align: left;
    padding: 0 0 0 3px;
  }
  .resident-unit /deep/ .el-input,
  /deep/ .el-input-number--mini {
    width: 43px;
    // margin-top: 7px;
  }
  /deep/ .el-checkbox-group {
    display: inline-block;
    padding-left: 12px;
  }
  /deep/ .el-form-item .resident-unit .el-form-item__content {
    display: flex;
  }
  /deep/
    .el-form-item
    .resident-unit
    .el-input-number.is-controls-right
    .el-input-number__decrease {
    bottom: revert;
    top: 14px;
  }
  
  /deep/ .subject-desc {
    margin-bottom: 9px;
  }
  .upload-content {
    width: 53%;
    margin-bottom: 5px;
  }
  .upload-tip {
    height: 22px;
    line-height: 25px;
    font-size: 13px;
    color: #888888;
  }


  /deep/ .el-form-item {
      margin-bottom: 0;
  }
}

.config-btn {
  margin: 30px 20px 10px 30px;
}
.text-desc {
  color: #fb696a;
}

/* 生成资源方案 */
.two-wrapper {
  max-width: 1070px;
  min-width: 910px;
  margin: 0 auto;
  padding-bottom: 20px;
  .wrapper-title {
    height: 40px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed #ccc;
    align-items: center;
    margin: 0 30px 30px 30px;
    .title-desc {
      font-size: 16px;
      font-weight: 700;
    }
    .del {
      color: #fc6063;
      cursor: pointer;
    }
  }
  .width-208 /deep/ .el-input {
    width: 208px;
  }
  .width-208.active /deep/ .el-form-item__label {
    width: 100px !important;
  }
  .width-530 /deep/ .el-form-item__content {
    width: 530px;

  }
   /deep/ .add {
    margin: 0 0 15px 30px;
  }
}
.download{
  color: var(--color-blue-main);
  cursor: pointer;
}
.file{
    height: 25px;
    line-height: 25px;
}
</style>
